package com.isdepci.project.factor.service.impl;

import java.util.List;

import com.isdepci.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.isdepci.project.factor.mapper.CarbonFactorInfoMapper;
import com.isdepci.project.factor.domain.CarbonFactorInfo;
import com.isdepci.project.factor.service.ICarbonFactorInfoService;

/**
 * 碳排放因子数据库Service业务层处理
 *
 * @author isdepci
 * @date 2024-10-10
 */
@Service
public class CarbonFactorInfoServiceImpl implements ICarbonFactorInfoService {
    @Autowired
    private CarbonFactorInfoMapper carbonFactorInfoMapper;

    /**
     * 查询碳排放因子数据库
     */
    @Override
    public CarbonFactorInfo selectCarbonFactorInfoById(Long id) {
        return carbonFactorInfoMapper.selectCarbonFactorInfoById(id);
    }

    /**
     * 查询碳排放因子数据库列表
     */
    @Override
    public List<CarbonFactorInfo> selectCarbonFactorInfoList(CarbonFactorInfo carbonFactorInfo) {
        return carbonFactorInfoMapper.selectCarbonFactorInfoList(carbonFactorInfo);
    }

    /**
     * 修改碳排放因子数据库
     */
    @Override
    public int saveCarbonFactorInfo(CarbonFactorInfo info) {
        if(info.getId()==null){
            info.setCreateUser();
            return carbonFactorInfoMapper.insertCarbonFactorInfo(info);
        }else {
            info.setUpdateUser();
            return carbonFactorInfoMapper.updateCarbonFactorInfo(info);
        }
    }

    /**
     * 批量删除碳排放因子数据库
     */
    @Override
    public int deleteCarbonFactorInfoByIds(Long[] ids) {
        return carbonFactorInfoMapper.deleteCarbonFactorInfoByIds(ids);
    }


}
